
/*  BEGIN_FILE_HDR
******************************************Copyright(C)*****************************************
*
*                                       YKXH  Technology
*
***********************************File Info***************************************************
*   File Name       @: CanTp_Cfg.h
************************************************************************************************
*   Project/Product @: CANTP
*   Title           @:
*   Author          @: zhongliang.Yang 
************************************************************************************************
*   Description     @: 
*
************************************************************************************************
*   Limitations     @: None
*
************************************************************************************************
*
************************************************************************************************
*   Revision History:
*
*   Version     Date          Initials           CR#         Descriptions
*   --------    -----------   ----------------   --------    -----------------------
*   1.0         2018/05/29    zhongliang.yang    N/A         Original 
*   1.1         xxxx/xx/xx    xxxxx              N/A         xxxxxxxx 
*
************************************************************************************************
* END_FILE_HDR*/
#ifndef CANTP_CFG_H
#define CANTP_CFG_H

/* -----------------------------------------------------------------------------
    &&&~ Include files
 ----------------------------------------------------------------------------- */
//#include "CanIf.h"
//#include "PduR_CanTp.h"
#include "../src/BSW/CommS/NM/UDS/Pdur/PduR_CanTp.h"
/**************************************************************************************************
* Global defines
**************************************************************************************************/

/* -----------------------------------------------------------------------------
    CanTpGeneral{CanTpConfiguration}
 ----------------------------------------------------------------------------- */

#define CANTP_VERSION_INFO_API               STD_OFF 
#define CANTP_DEV_ERROR_DETECT               STD_OFF
#define CANTP_PROD_ERROR_DETECT              STD_ON
#define CANTP_TC                             STD_ON
#define CANTP_MAIN_FUNCTION_PERIOD           10u  /*ms*/

/* -----------------------------------------------------------------------------
    CanTpChannel
 ----------------------------------------------------------------------------- */
//#define CANTP_CHANNEL_MODE                  CANTP_MODE_HALF_DUPLEX/*CANTP_MODE_FULL_DUPLEX*/
#define CANTP_FILLPATTERN                   0x55u
/* Maximum number of SDUs supported by the CanTp on this ECU */

#define CANTP_CHANNELS                      1u  //  4u


#define CANTP_NUM_RX_SDUS                   2u  //4
#define CANTP_NUM_TX_SDUS                   1u  //4  

#define CANTP_NUM_RX_CHANNELS               CANTP_CHANNELS
#define CANTP_NUM_TX_CHANNELS               CANTP_CHANNELS

#define CanTp_CanInterruptDisable()     //CANIF_ENTER_CRITICAL_SECTION()
#define CanTp_CanInterruptRestore()     //CANIF_LEAVE_CRITICAL_SECTION()

#define CanTp_CanTransmit(txSduIdx,pduInfo)    CanIf_Transmit(txSduIdx,pduInfo)
/*
* Description : The network layer use  the service function that is provided by the lower layer to transmit N-PDU.
*
*******************************************************************************/
#if(CANIF_PUBLIC_CANCEL_TRANSMIT_SUPPORT == STD_ON)
#define CanTp_CanCancelTransmit(txSduIdx)       CanIf_CancelTransmit(txSduIdx)
#else
#define CanTp_CanCancelTransmit(txSduIdx) E_OK
#endif
/*
* Description : The network layer use  the service function that is provided by the lower layer to cancle transmit N-PDU.
*
*******************************************************************************/

#define  CanTp_NUSDataIndication(rxSduIdx,canTpErrorCode)  {PduR_CanTpRxIndication(rxSduIdx,canTpErrorCode);CanTp_ChannelInit(CANTP_RX_CHANNEL,CanTpRxChannelId);}

             

/*
* Description : This service is used by the network layer to pass status information and received data to
upper communication layers or the application;
*
*******************************************************************************/
#define CanTp_NUSDataConfirm(txSduIdx,canTpErrorCode)       {PduR_CanTpTxConfirmation(txSduIdx,canTpErrorCode);CanTp_ChannelInit(CANTP_TX_CHANNEL,CanTpTxChannelId); }
//PduR_CanTpTxConfirmation(txSduIdx,canTpErrorCode)/* -- -*/
/*
* Description : This service is used by the network layer to pass status information to higher
communication layers or the application.
*******************************************************************************/
#define CanTp_NUSDataFFIndication(rxSduIdx,length,bufferSizePtr)   PduR_CanTpStartOfReception(rxSduIdx,length,bufferSizePtr)
                                      
/*
* Description : This service is used to signal the beginning of a segmented message reception to the upper layer.
*******************************************************************************/
#define CanTp_NUSDataSFIndication(rxSduIdx,length,bufferSizePtr)   PduR_CanTpStartOfReception(rxSduIdx,length,bufferSizePtr)

/*
* Description : This service is used to signal the beginning of a segmented message reception to the upper layer.
*******************************************************************************/

#define CanTp_CopyRxData(rxSduIdx,pduInfo,bufferSizePtr)   PduR_CanTpCopyRxData(rxSduIdx,pduInfo,bufferSizePtr)
/*
* Description : The network layer use  the  function that is provided by the upper layer 
        to copy data of received N-PDU to buffer provided by the upper layer .
*******************************************************************************/

#define CanTp_CopyTxData(txSduIdx,pduInfo,NULL_PTR,bufferSizePtr)   PduR_CanTpCopyTxData(txSduIdx,pduInfo,NULL_PTR,bufferSizePtr)
/*
* Description : The network layer use  the  function that is provided by the upper layer 
        to copy data of transmitted N-PDU from buffer provided by the upper layer  to network layer.
*******************************************************************************/
/**************************************************************************************************
* Global data types and structures
**************************************************************************************************/

 /**************************************************************************************************
* Gloable Data definitions
**************************************************************************************************/




#endif /* CANTP_CFG_H */
/************************ Version 1.0.0 ***************************/
